/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package nl.unimaas.games.tron.util;

/**
 *
 * @author Cliff Laschet
 */
public class NGramNode {
    private double N;
    private double avg;
    
    /**
     * 
     */
    public NGramNode(){
        this.avg = 0;
        this.N = 0;
    }
    
    /**
     * 
     * @param value 
     */
    public NGramNode(double value){
        this.avg = value;
        this.N = 1;
    }
    
    /**
     * 
     * @param value
     * @param visits 
     */
    public NGramNode(double value, double visits){
        this.avg = value;
        this.N = visits;
    }
    
    /**
     * 
     * @param value 
     */
    public void update(double value){
        N++;
        avg += value;
    }
    
    /**
     * 
     * @return 
     */
    public double getValue(){
        return (avg/N);
    }
}
